package com.demo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author gxd
 * @since 2025/6/1
 */
@Getter
@AllArgsConstructor
public enum DictStatusEnum {
    DISABLE(0, "停用"),
    OK(1, "启用");

    private final int code;
    private final String message;

    public String isOK(int code) {
        for (DictStatusEnum statusEnum : DictStatusEnum.values()) {
            if (statusEnum.getCode() == code) {
                return statusEnum.getMessage();
            }
        }

        throw new RuntimeException("未通过当前code查询到合法的枚举类型code=" + code);
    }
}
